/*
 * XDVRenderer.h
 *
 *  Created on: May 21, 2013
 *      Author: daviD
 */

#ifndef XDVRENDERER_H_
#define XDVRENDERER_H_

class XDVLight;
class XDVCamera;
class XDVRenderComponent;
class XDVDeferredRendering;
class XDVFBORenderTexture;

#include <list>

class XDVRenderer
{
public:
	virtual ~XDVRenderer();
	static XDVRenderer& Instance()
	{
		static XDVRenderer singleton;
		return singleton;
	}

	void Add(XDVLight * light) {m_lights.push_back(light);}
	void Add(XDVCamera * cam) {m_cams.push_back(cam);}
	void Add(XDVRenderComponent * toAdd) {m_objects.push_back(toAdd);}

	void Remove(XDVLight * light) {m_lights.remove(light);}
	void Remove(XDVCamera * cam) {m_cams.remove(cam);}
	void Remove(XDVRenderComponent * toRemove) {m_objects.remove(toRemove);}

	void DoRender();

	void SetWidth(int width) {m_width = width;}
	void SetHeight(int height) {m_height = height;}
	int GetWidth() {return m_width;}
	int GetHeight() {return m_height;}

private:
	XDVRenderer();
	XDVRenderer(const XDVRenderer&);
	XDVRenderer& operator=(const XDVRenderer&);

	void GeometryPass();
	void LightingPass();

	std::list<XDVLight *> m_lights;
	std::list<XDVCamera *> m_cams;
	std::list<XDVRenderComponent *> m_objects;

	XDVDeferredRendering* m_deferredrenderer;
	XDVFBORenderTexture* m_fborendertexture;

	int m_width;
	int m_height;
};

#endif /* XDVRENDERER_H_ */
